<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
	<div class="header">
		<div class="tab_content_header left"><label>Report Parameters</label></div>
		<div class="tab_content_header right"><label>Report Parameters Description</label></div>
	</div>
	<div class="left">
		<div class="tab_params_content_body">
			<c:choose>
				<c:when test='${fn:length(REPORT_PARAMETERS) == 0}'>
					<span class="paramMessage">This report does not require any parameters</span>
				</c:when>
				<c:otherwise>
					<c:forEach var="prm" items="${REPORT_PARAMETERS}">
						<div class="content_row <c:if test="${prm.valueClassName == 'java.lang.Boolean'}">content_row_first</c:if>">
							<div class="input_left"><span class="prm_name">${prm.name}</span></div>
							<div class="input">
								<c:if test="${prm.valueClassName == 'java.lang.Boolean'}"><input type="checkbox" onClick="setParams()" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.lang.Byte'}"><input type="text"  paramType="byte" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.util.Date' || prm.valueClassName == 'java.sql.Timestamp'}">
                                    <input type="hidden" value="" name="prm_${prm.name}" />
                                    <div class="ExplicitDerived" style="overflow:hidden;">
                                        <input id="${prm.name}Explicit" type="radio" name="${prm.name}Group" value="Explicit" checked/>
                                        <span class="label" style="float:none;">
                                            <label for="${prm.name}Explicit">Exact</label>
                                        </span>
                                        <input id="${prm.name}Derived" type="radio" name="${prm.name}Group" value="Derived"/>
                                        <span class="label" style="float:none;">
                                            <label for="${prm.name}Derived">Calculated</label>
                                        </span>
                                    </div>
                                    <div class="paramExplicit">
                                        <input type="text"  paramType="" class="parameters" title="Enter ${prm.name}" name="p_${prm.name}" id="${prm.name}"  />
                                        <img class="datepickerBtnImg" src="/reporting-web/images/datepicker_button.png" onclick="document.getElementById('${prm.name}').focus();" />
                                    </div>
                                    <div class="paramDerived" style="display:none">
                                        <div>
                                            <input type="text" class="quantity" value="1"/>
                                            <select class="interval">
                                                <option value="1">Day(s)</option>
                                                <option value="2">Week(s)</option>
                                                <option value="3">Month(s)</option>
                                            </select>
                                            <span class="calculatedRightText">Before run date</span>
                                        </div>
                                        <div style="display:none">
                                            <div class="derivedLabel">Boundary</div>
                                            <select class="boundary">
                                                <option value="1">Beginning</option>
                                                <option value="2">Ending</option>
                                            </select>
                                        </div>
                                        <div>
                                            <span class="footerDerivedText">For example, if run date is <span class="rundate"></span> then the ${prm.name} will be <span class="calculatedDate"></span></span>
                                        </div>
                                    </div>
                                    <script>
                                        var returnedVal = "${prm.description}".split('&v&')[1];
                                        if("${prm.valueClassName}" == "java.util.Date"){
                                            $("[id=${prm.name}]").attr("paramType","date");
                                            setValue($("[id=${prm.name}]" ),"${prm.description}");
                                            $("[id=${prm.name}]").datepicker({ changeYear: true, onClose: function(dateText, inst) {
                                                setParams();
                                                $(this).parents("div.input").children("input[type=hidden]").val(dateText);
                                            }});
                                        }else{
                                            $("[id=${prm.name}]").attr("paramType","timestamp");
                                            setValue($("[id=${prm.name}]" ),"${prm.description}");
                                            $("[id=${prm.name}]").datetimepicker({ changeYear: true, onClose: function(dateText, inst) {
                                                setParams();
                                                $("[id=${prm.name}]").parents("div.input").children("input[type=hidden]").val(dateText);
                                            }});
                                        }
                                        var $lastDiv = $(".tab_params_content_body>div:last");
                                        $(".input",$lastDiv).addClass("ExplicitDerivedBorder");
                                        if (returnedVal.split("_")[1]==undefined){
                                            $("input[type=radio][value=Explicit]",$lastDiv).attr("checked","checked");
                                        }else{
                                            $(".paramExplicit input",$lastDiv).val("");
                                            $("input[type=radio][value=Derived]",$lastDiv).attr("checked","checked");
                                            $(".boundary",$lastDiv).val(returnedVal.split("_")[2]);
                                            $(".interval",$lastDiv).val(returnedVal.split("_")[0]);
                                            $(".quantity",$lastDiv).val(returnedVal.split("_")[1]);
                                            $(".ExplicitDerived",$lastDiv).data("description","${prm.description}".split("&v&")[0]);
                                            $(".paramDerived",$lastDiv).show();
                                            $(".paramExplicit",$lastDiv).hide();
                                        }
                                        $("input[type=hidden]",$lastDiv).val(returnedVal);
                                    </script>
								</c:if>
								<c:if test="${prm.valueClassName == 'java.lang.Float'}"><input type="text" paramType="float" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.lang.Integer'}"><input title="Enter ${prm.name}" paramType="integer" type="text" onBlur="setParams()" class="parameters" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.lang.Long'}"><input type="text" paramType="long" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.lang.Short'}"><input type="text" paramType="short" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.lang.Number'}"><input type="text" paramType="number" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.lang.String'}"><input type="text" paramType="string" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.sql.Time'}">
									<input type="text" paramType="time" class="parameters" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  />
									<img class="datepickerBtnImg" src="/reporting-web/images/datepicker_button.png" onclick="document.getElementById('${prm.name}').focus();" />
									<script>
										setValue($( "[id=${prm.name}]" ),"${prm.description}");
										$( "[id=${prm.name}]" ).timepicker({onClose: function(dateText, inst) { setParams()}});
									</script>
								</c:if>
								<c:if test="${prm.valueClassName == 'java.lang.Double'}"><input type="text" paramType="double" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.math.BigDecimal'}"><input type="text" paramType="bigdecimal" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.util.List'}"><input type="text" paramType="list" class="parameters" onBlur="setParams()" title="Enter ${prm.name}" name="prm_${prm.name}" id="${prm.name}"  /><script>setValue($( "[id=${prm.name}]" ),"${prm.description}");</script></c:if>
								<c:if test="${prm.valueClassName == 'java.lang.Object'}"></c:if>
								<c:if test="${prm.valueClassName == 'java.sql.Timestamp'}"></c:if>
							</div>
						</div>
					</c:forEach>
				</c:otherwise>
			</c:choose>
		</div>
	</div>
	<div class="right">
		<div id="report_parameter_description" class="textContainer ui-corner-all"></div>
	</div>